<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 *  
 * @property  Curl $curl
 */

/** // very important annotations
* @property CI_Loader $load
* @property CI_Form_validation $form_validation
* @property CI_Input $input
* @property CI_Email $email
* @property CI_DB_active_record $db
* @property CI_Session $session
* @property CI_Config $config
* @property CI_URI $uri
* @property CI_Upload $upload
* @property CI_Pagination $pagination
* @property CI_Table $table
*
*/





 class SearchEngine extends CI_Controller
{

     function smartSearch() {
        $i=0;
        // $keyword taken as tags .. like this $_POST['submit']
        // $keyword must be passed from caller of this controller ..
        // 
        // 
         $keyword= $_POST['tags'];
         //echo print_r($keyword);
      //$keyword='summer';
  //
  //echo('here');

        
        
        
    
  
        // triming and refining keywords
       // $keyword = trim($keyword) ; 


        // searching the web engine bing.com
       $this->load->model('WebSearchEngine_model') ;
        $WebResults = $this->WebSearchEngine_model->searchTheWebEngine($keyword) ;


        

        // searching public situations ..
        $this->load->model('WebSearchEngine_model') ;
        //echo $keyword;
        $publicResults = $this->WebSearchEngine_model->searchPublicSituation($keyword) ;


        $data=  array( 
            
        'publicResults' => $publicResults,

        'WebResults' => $WebResults  
            );
      
        //$json=json_encode($data);
	//	echo $json;
        
    //  print_r($data);  
       $this->load->view('WebSearchEngine_view', $data);
        

        
    }
    
    function publicsearch()
    {
         $keyword= $_POST['tags'];
           //$keyword='summer';

         //$keywords=explode(" ",$keyword);

        // searching public situations ..
        $this->load->model('WebSearchEngine_model') ;
        $publicResults = $this->WebSearchEngine_model->searchPublicSituationPublicSearch($keyword) ;

        //echo $keywords;
        $data=  array( 
            
        'publicResults' => $publicResults,);
        
       $this->load->view('public_view', $data);
        
    }

    function publicsearch_home()
    {
         $keyword= $_POST['tags'];
           //$keyword='summer';

         //$keywords=explode(" ",$keyword);

        // searching public situations ..
        $this->load->model('WebSearchEngine_model') ;
        $publicResults = $this->WebSearchEngine_model->searchPublicSituationPublicSearch($keyword) ;

        //echo $keywords;
        $data=  array(

        'publicResults' => $publicResults);
        //$json=json_encode($data);
    //    echo $json;
          $this->load->view('visitorsearch', $data);
    }

   
    

     
     }